/**
 * 
 */
package src.model.gameObject.eventBrokers;

import java.util.HashMap;

import src.model.gameObject.GameObject;
import src.model.gameObject.eventInterfaces.MeleeEventListener;
import sun.applet.Main;

/**
 * @author Tristan
 *
 */
public class MeleeEventBroker {
	
	private static MeleeEventBroker staticReference;
	
	private HashMap<GameObject, MeleeEventListener> GameObjectsToListener;
	
	/**
	 * 
	 */
	public MeleeEventBroker() {
		staticReference = this;
		GameObjectsToListener = new HashMap<GameObject, MeleeEventListener>();
	}
	
	public static void register(GameObject go, MeleeEventListener m){
		staticReference.GameObjectsToListener.put(go, m);
	}
	
	public static void unregister(GameObject go){
		staticReference.GameObjectsToListener.remove(go);
	}
	
	public static void notifyGameObjectMeleedGameObject(GameObject attacker, GameObject defender){
		MeleeEventListener listener = staticReference.GameObjectsToListener.get(defender);
		listener.notifyMeleeEvent(attacker);
	}
	
}
